export interface ApiResponse<T = unknown> {
  code: number
  message: string
  data?: T | null
}

export interface LoginReq {
  username: string
  password: string
}

export type LoginRes = ApiResponse<string>

export type UserInfoRes = ApiResponse<CheckUser>

export interface CheckUser {
  id: number
  username: string
  status: number | string
  avatar: string
  roles: string[]
  routes: string[]
  buttons: string[]
  nickName: string
  post: {
    id: number
    name: string
  }
  organization: {
    id: number
    name: string
    code: string
  }
  createdAt: string
  updatedAt: string
}

export interface UpdateUserInfo {
  nickName?: string
  avatar?: string
}

export type UpdateUserInfoRes = ApiResponse<void>

export type LogoutRes = ApiResponse<string>

export interface ChangePasswordReq {
  oldPassword: string
  newPassword: string
}

export type ChangePasswordRes = ApiResponse<string>
